"""
三个列表表示三个部门的人员情况
"""
test_department = ['小明', '小张', '小黄', '小杨']
research_department = ['小黄', '小李', '小王', '小杨', '小周']
market_department = ['小杨', '小张', '小吴', '小冯', '小周']


def sum_number(list1: list, list2: list, list3: list):
    """
    1)	求部门员工总共有多少人
    """
    return len(list1) + len(list2) + len(list3)


def count_people(list1: list, list2: list, list3: list):
    """
    2)	求只在一个部门存在的人的数量和对应的名字
    """
    people = {}
    list1.extend(list2)
    list1.extend(list3)
    for person in list1:
        if person in people:
            people[person] += 1
        else:
            people[person] = 1
    for p in people.keys():
        if people[p] > 1:
            del people[p]
    return people


def count_people_2(list1: list, list2: list, list3: list):
    """
    3)	在两个部门以及以上的人员有哪些
    """
    people = {}
    list1.extend(list2)
    list1.extend(list3)
    for person in list1:
        if person in people:
            people[person] += 1
        else:
            people[person] = 1
    for p in people.keys():
        if people[p] == 1:
            del people[p]
    return people
